<template>
  <view class="qrcode">
    <view class="text">
      <view>点击图片预览，长按保存</view>
      <!-- <view></view> -->
    </view>
    <image class="qrcode-image" :src="image" @click="previewImage" mode="aspectFit" />
  </view>
</template>

<script>
export default {
  data() {
    return {
      image:
        "",
    };
  },
  methods: {
    /**
     * 预览图片
     */
    previewImage() {
      uni.previewImage({
        urls: [this.image],
        longPressActions: {
          itemList: ["发送给朋友", "保存图片", "收藏"],
          success: function (data) {
            console.log(
              "选中了第" +
                (data.tapIndex + 1) +
                "个按钮,第" +
                (data.index + 1) +
                "张图片"
            );
          },
          fail: function (err) {
            console.log(err.errMsg);
          },
        },
      });
    },
  },
  onLoad(option) {
	  
  },
  onShow() {
  	this.$u.api.merchantQrcodeApi().then((res) => {
  	   this.image = res.url
	})
  }
};
</script>

<style scoped lang ='scss' >
.qrcode {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  .text {
    /* padding: 20rpx; */
    margin-top: 60rpx;
    & > view {
      text-align: center;
      &:nth-child(1){
          font-size: 40rpx;
          margin-bottom: 10rpx;
      }
    }
  }
  .qrcode-image{
	  height: 1300rpx;
  }
}
</style>
